🎖️GitЯра🎖️
docs/en/developer/persistence.md 4d4070c8e1ed73a56ee2f054300a0f62e3fe2e62 (4d4070c8) Text, 3.28 KB
---
title: Persistence
parent: Developer Guide
nav_order: 6
last_updated: 2026-07-08
aliases:
Tff7b72- room
Tff7b72- database
Tff7b72- datastore
Tc9d1d9 - prefs
Tc9d1d9---
Tc9d1d9# Persistence
How the Meshtastic app stores data across different mechanisms.
Tc9d1d9## Room KMP Database
**Module:** Ta5d6ff`core:database`
The primary structured data store:
Tff7b72- Node information and history
Tff7b72- Message history
Tff7b72- Waypoints
Tff7b72- Telemetry data
Tff7b72- Channel configurations
Tc9d1d9### Key Points
Tff7b72- Uses Room KMP for cross-platform compatibility
Tff7b72- Migrations managed through Room's built-in migration system
Tff7b72- DAO interfaces live in Ta5d6ff`core:database`
Tff7b72- Repository layer in Ta5d6ff`core:repository` provides the public API
Tff7b72- Full-text message search is backed by an FTS5 content table (Ta5d6ff`PacketFts`) over Ta5d6ff`Packet`, kept in sync by Room-managed triggers
Tc9d1d9### What's Stored in Room
| Entity | Description |
|--------|-------------|
| Ta5d6ff`NodeEntity` | All known mesh nodes and their metadata |
| Ta5d6ff`MyNodeEntity` | The local node's own info |
| Ta5d6ff`Packet` | Message history (channel and direct), waypoints, and telemetry data |
| Ta5d6ff`PacketFts` | FTS5 virtual table mirroring Ta5d6ff`Packet.messageText` for full-text message search (Room-managed INSERT/UPDATE/DELETE triggers keep it in sync) |
| Ta5d6ff`ContactSettings` | Per-contact mute and read-state |
| Ta5d6ff`ReactionEntity` | Emoji reactions on messages |
| Ta5d6ff`MeshLog` | Raw mesh protocol logs |
| Ta5d6ff`MetadataEntity` | Device metadata (firmware version, hardware model) |
| Ta5d6ff`QuickChatAction` | User-configured quick-chat messages |
| Ta5d6ff`DeviceHardwareEntity` | Cached device hardware catalog |
| Ta5d6ff`FirmwareReleaseEntity` | Cached firmware release info |
| Ta5d6ff`TracerouteNodePositionEntity` | Traceroute hop position data |
| Ta5d6ff`DiscoverySessionEntity` | A Local Mesh Discovery scan session (timestamp, presets scanned, home preset) |
| Ta5d6ff`DiscoveryPresetResultEntity` | Per-preset result within a discovery session |
| Ta5d6ff`DiscoveredNodeEntity` | Nodes found during a discovery preset scan |
| Ta5d6ff`DeviceLinkEntity` | Cached Ta5d6ff`msh.to` device links from the Meshtastic API |
Tff7b72> 💡 **Note:** Waypoints, telemetry, and channel data are stored within the `Packet` entity (using the `port_num` field to distinguish packet types) rather than in separate tables.
Tc9d1d9## DataStore Preferences
**Module:** Ta5d6ff`core:datastore`
For lightweight key-value preferences:
Tff7b72- Local radio configuration (LocalConfig proto)
Tff7b72- Module configuration (ModuleConfig proto)
Tff7b72- Channel set data
Tff7b72- Local statistics
Tff7b72- Recently connected device addresses
Tc9d1d9## Core Prefs
**Module:** Ta5d6ff`core:prefs`
Higher-level preferences abstraction:
Tff7b72- User-facing settings
Tff7b72- App behavior configuration
Tff7b72- Feature toggles
Tc9d1d9## What Docs Intentionally Skip
The Ta5d6ff`feature:docs` module uses **no** Room or persistent database. Documentation ships as build-time assets versioned with the app binary, so it stays fully offline, is replaced on each update, and needs no migration story. Optional UX state (e.g. last viewed page) could live in Ta5d6ff`core:prefs` but isn't part of the docs data model.
Tc9d1d9## Best Practices
Tff7b72- Use Room for structured, queryable data that changes at runtime
Tff7b72- Use DataStore for simple preferences and state
Tff7b72- Use bundled resources/assets for static content
Tff7b72- Never store sensitive data (keys, passwords) in plain Room tables
Tff7b72- Always provide migrations for schema changes
---
Served by rngit 1.5.0 - Generated in 0.07s